package com.em.tuppence.web.services.client;

import org.codehaus.jackson.jaxrs.JacksonJsonProvider;

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;
import com.sun.jersey.api.json.JSONConfiguration;

public enum UserServiceClientFactory {

	INSTANCE;
	
	private UserServiceClientFactory() {
		
	}
	
	public Client getClient() {
		//configure jersey client for json
		ClientConfig cc = new DefaultClientConfig();
		cc.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
		cc.getClasses().add(JacksonJsonProvider.class);
		Client client = Client.create(cc);
		
		//return client
		return client;
	}
	
}
